using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: daiduong19051986@gmail.com 
	/// <summary>
	
    public class TVC_LOOKUPInfo
    {
		#region Local Variable
		public enum Field
		{
			TB,
			TBField,
			Code,
			Lookup,
			Description,
			Status
		}
		private String _TB;
		private String _TBField;
		private String _Code;
		private String _Lookup;
		private String _Description;
		private String _Status;
		
		public String TB{	get{ return _TB;} set{_TB = value;} }
		public String TBField{	get{ return _TBField;} set{_TBField = value;} }
		public String Code{	get{ return _Code;} set{_Code = value;} }
		public String Lookup{	get{ return _Lookup;} set{_Lookup = value;} }
		public String Description{	get{ return _Description;} set{_Description = value;} }
		public String Status{	get{ return _Status;} set{_Status = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public TVC_LOOKUPInfo()
		{
			_TB = "";
			_TBField = "";
			_Code = "";
			_Lookup = "";
			_Description = "";
			_Status = "";
		}
		public TVC_LOOKUPInfo(
		String TB,
		String TBField,
		String Code,
		String Lookup,
		String Description,
		String Status
		)
		{
			_TB = TB;
			_TBField = TBField;
			_Code = Code;
			_Lookup = Lookup;
			_Description = Description;
			_Status = Status;
		}
		public TVC_LOOKUPInfo(DataRow dr)
		{
			if (dr != null)
			{
				_TB = dr[Field.TB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TB.ToString()]);
				_TBField = dr[Field.TBField.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TBField.ToString()]);
				_Code = dr[Field.Code.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Code.ToString()]);
				_Lookup = dr[Field.Lookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Lookup.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Status = dr[Field.Status.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Status.ToString()]);
			}
		}
		public TVC_LOOKUPInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_TB = dr[Field.TB.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TB.ToString()]);
				_TBField = dr[Field.TBField.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TBField.ToString()]);
				_Code = dr[Field.Code.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Code.ToString()]);
				_Lookup = dr[Field.Lookup.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Lookup.ToString()]);
				_Description = dr[Field.Description.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Description.ToString()]);
				_Status = dr[Field.Status.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.Status.ToString()]);
			}
		}
		public TVC_LOOKUPInfo(TVC_LOOKUPInfo objEntr)
		{			
			_TB = objEntr.TB;			
			_TBField = objEntr.TBField;			
			_Code = objEntr.Code;			
			_Lookup = objEntr.Lookup;			
			_Description = objEntr.Description;			
			_Status = objEntr.Status;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("TVC_LOOKUPHVJ");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.TB.ToString(), typeof(String)),
				new DataColumn(Field.TBField.ToString(), typeof(String)),
				new DataColumn(Field.Code.ToString(), typeof(String)),
				new DataColumn(Field.Lookup.ToString(), typeof(String)),
				new DataColumn(Field.Description.ToString(), typeof(String)),
				new DataColumn(Field.Status.ToString(), typeof(String))
			});
			return dt;
		}
        public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.TB.ToString()] = _TB;
			row[Field.TBField.ToString()] = _TBField;
			row[Field.Code.ToString()] = _Code;
			row[Field.Lookup.ToString()] = _Lookup;
			row[Field.Description.ToString()] = _Description;
			row[Field.Status.ToString()] = _Status;
			return row;
		}
        #endregion InitTable
    }
}
